import CollectionInstance from "./Collection";
import { UserService } from "./UserService";
import { Inject } from "./injectdecortator";
import { get } from "./methoddecorator";
import { Controller } from "./ControllerDecorator";

// 安装元数据的第三方包： yarn add reflect-metadata -S
// 元数据 -- 为了帮助类,方法,属性实现一定的功能, 而附加在其上的一些数据
// 分类: 自定义的元数据, 内置元数据

// 装饰器执行顺序: 属性装饰器 -> 方法装饰器 -> 类装饰器
@Controller("/")
class UserController {
  @Inject("userService")
  private userService?: UserService;

  @get("/login")
  public login(username: string, pwd: number): number {
    let peopleServiceInstace = CollectionInstance.get("userService");
    peopleServiceInstace.login();

    return 3;
  }
}

/* let userController = new UserController();
userController.login();
console.log("first"); */

export {};
